# -*- coding: utf-8 -*-

# $Id: update.py 2 2012-09-01 15:54:17Z alexis.roda.villalonga@gmail.com $

from dja_skel.skeletons.base import BaseModelViewSkel


class UpdateViewSkel(BaseModelViewSkel):
    """Skeleton for the *update* view.
    """
    variables = ("applabel", "ModelName")
    skeleton_path = "templates/update"
    summary = "Skeleton that creates a CBV update view."

    def get_view_module_map(self):
        context = self._context
        return [(
            "{}_update".format(context["model_name"]),
            "{}_update_view".format(context["model_name"]),
            )]

    def get_view_url_map(self):
        context = self._context
        return [(
            r"^{}/(?P<pk>\d+)/update/$".format(context["model_name"]),
            "{}_update_view".format(context["model_name"]),
            )]
